package edu.buaa.common.client;

import com.alibaba.fastjson.JSON;
import com.google.common.util.concurrent.ListenableFuture;
import edu.buaa.common.transaction.AbstractTransaction;
import edu.buaa.utils.Helper;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

public class Neo4jExecutorClient extends AbstractNeoClient{

    public Neo4jExecutorClient(String serverHost, int port, int parallelCnt) throws IOException, ExecutionException, InterruptedException {
        super(serverHost, port, parallelCnt);
    }

    @Override
    public ListenableFuture<ServerResponse> execute(AbstractTransaction tx) throws Exception{
        return this.addQuery(JSON.toJSONString(tx, Helper.serializerPropFilters, Helper.serializerFeatures), tx.getSection());
    }
}
